The present invention relates to optimizing processing of electronic documents, such as Extensible Markup Language (XML) documents or similar electronic documents, and more particularly to a method and system for processing an electronic document using streaming optimization via programmatic analysis.
The Extensible Markup Language (XML) has gained popularity as a standardized syntax for communications over networks such as the Internet, and is being used in a wide range of applications ranging from short machine-to-machine messages up to extensive databases and documents. One limiting factor in the use of XML and XML tooling is that naive or simple processing approaches break down or become less efficient as document size increases. Loading an entire document into an in-memory data model (equivalently, document model) for processing, while efficient for small documents, becomes more onerous as the model size increases, requiring much more memory capacity and processing time. None the less, many tasks have been driven to use such models, since they may involve random access to the document's contents and thus may need substantially the entire document to be available for immediate retrieval. Extensible Stylesheet Language Transformation (XSLT) stylesheet execution is one example of such a random-access task; the XSLT language may access any portion of the input document at any time during processing.